package sk.ogame.brain.thing;

import sk.ogame.realm.exception.BaseException;
import sk.ogame.realm.exception.PlanetNoInfoException;
import sk.ogame.realm.service.PlanetService;

import java.beans.Transient;
import java.util.Collections;
import java.util.Set;

/**
 * @author 支绍昆
 * 2023/2/17
 * 获取星球信息
 **/
public class PlanetThing extends Thing {

    private final int planetId;
    private final Operate operate;

    public enum Operate {getInfo, getOverview;}

    public PlanetThing(int planetId, Operate operate) {
        this.planetId = planetId;
        this.operate = operate;
    }

    @Override
    public Set<Class<? extends BaseException>> couldSolve() {
        return Collections.singleton(PlanetNoInfoException.class);
    }

    @Transient
    @Override
    public Class<? extends ThingService> getDealBeanType() {
        return PlanetService.class;
    }

    @Override
    public String toString() {
        return "planet [" + planetId + "] " + operate.name() + " .";
    }

    public int getPlanetId() {
        return planetId;
    }

    public Operate getOperate() {
        return operate;
    }
}
